package com.gjy.nio;

import com.gjy.util.ObjectUtil;
import org.junit.jupiter.api.Test;

import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;

/**
 * @author 宫静雨
 * @version 1.0
 * @since 2023-03-14 09:13:39
 */
public class Nio1Test1 {

    @Test
    public void test1() {
        ByteBuffer buffer = ByteBuffer.wrap("Hello".getBytes(StandardCharsets.UTF_8));
        System.out.println("buffer.remaining() = " + buffer.remaining());
        while (buffer.hasRemaining()) {
            byte b = buffer.get();
            System.out.println("b = " + (char) b);
        }
    }

    @Test
    public void test() {
        System.out.println(ObjectUtil.bytes('G'));
    }
}
